//
//  ZCmainCell.m
//  zctx
//
//  Created by Yi luqi on 15/10/7.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCmainCell.h"
#import "ZCMainModel.h"

@implementation ZCmainCell

- (void)awakeFromNib {
    // Initialization code
 
}

-(void)setMainModel:(ZCMainModel *)mainModel{
    
    _mainModel = mainModel;
    
    self.nameLable.text =[NSString stringWithFormat:@"%@",_mainModel.pjname];
    self.locationLable.text = [NSString stringWithFormat:@"%@",_mainModel.location];
    
    if (_mainModel.institution.length>0) {
        self.institutionLable.text = [NSString stringWithFormat:@"%@",_mainModel.institution];
    }else{
        self.institutionLable.text =@"";
    }
    if (_mainModel.location.length>0) {
        self.locationLable.text = [NSString stringWithFormat:@"%@",_mainModel.location];
    }else{  
        self.locationLable.text =@"";
    }
    
    NSURL *url =[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",[NetworkManager strURLBasic],_mainModel.thumb]];    
    [self.ImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeholderImg"]];
    
    NSString *result =[NSString stringWithFormat:@"%@",_mainModel.result];
    if ([result isEqualToString:@"0"]) {
        //未知情况
    }else if ([result isEqualToString:@"1"]){
        //合格
        [self.stateButton setTitle:@"合格" forState:UIControlStateNormal];
        [self.stateButton setTitleColor:MainColor forState:UIControlStateNormal];
    }else{
//        //不合格
        [self.stateButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        [self.stateButton setTitle:@"不合格" forState:UIControlStateNormal];
        [self.stateButton setBackgroundImage:[UIImage imageNamed:@"main_red"] forState:UIControlStateNormal];
    }
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
